#include <stdio.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <signal.h>
#include <sys/epoll.h>
#include <stdlib.h>
#include <sys/mman.h>

int main(int argc,char **argv)
{ 
    int fd = 0;
    int val = 0;
    int count = 0;

    fd = open("/dev/eint_key", O_RDWR);
    if (fd < 0) {
        printf("open failed errno=%d\n", errno);
        printf("%s\n", strerror(errno)); 
        return -1;
    }

    printf("fd = %d\n", fd);

    while (1) {
        if (count == 10) {
            break;
        }
        read(fd, &val, 1);
        printf("val=%d\n", val);

        sleep(2);
        count++;
    }

    close(fd);

    return 0;
}